package com.sean.animation;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.CycleInterpolator;
import android.view.animation.TranslateAnimation;

public class TranslateView extends View {
	
	private Animation mAnimation;

    public TranslateView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.setBackgroundColor(Color.RED);
    }

    public void startAnimation() {
    	mAnimation = new TranslateAnimation(0f, 200f, 0f, 100f);
    	mAnimation.setDuration(1000);
    	mAnimation.setInterpolator(new CycleInterpolator(1f));
    	mAnimation.setFillAfter(true);
    	this.startAnimation(mAnimation);
    }
}
